package com.victor.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.victor.dao.CopyrightDao;
import com.victor.entity.Copyright;
import com.victor.service.CopyrightService;

@Service
public class CopyrightServiceImpl implements CopyrightService {

	@Autowired
	private CopyrightDao copyrightDao;

	// 获取所有版权方列表
	@Override
	public List<Copyright> getAllCopyright() {
		return copyrightDao.getAllCopyright();
	}

	// 通过新建的账号去数据库查询是否重复
	@Override
	public Copyright loginexistCopyright(String cr_account) {
		return copyrightDao.loginexistCopyright(cr_account);
	}

	// 插入数据库版权方
	@Override
	public boolean createCopyright(Copyright copyright) {
		return copyrightDao.createCopyright(copyright) > 0 ? true : false;
	}

	// 修改信息
	@Override
	public boolean updateCopyright(Copyright copyright) {
		return copyrightDao.updateCopyright(copyright) > 0 ? true : false;
	}

	// 批量删除版权方
	@Override
	public boolean batchDeleteCopyright(int[] ids) {
		return copyrightDao.batchDeleteCopyright(ids) > 0 ? true : false;
	}

	// 版权方登录判断
	@Override
	public Copyright loginCopyright(Copyright copyright) {
		return copyrightDao.loginCopyright(copyright);
	}

	@Override
	public List<Copyright> search(String name) {
		if (name == null) {
			name = "";
		}
		List<Copyright> search = copyrightDao.search(name);
		return search;
	}

}
